package com.tf_cut.backend.seller.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.tf_cut.backend.request.CommomRequstHandle;

@RestController
@RequestMapping("/backend/sellerpayment/")
public class SellerPaymentController {
	
    @Autowired
    private CommomRequstHandle commomRequstHandle;
	
    @ResponseBody
    @PostMapping(value = "/notify", produces = MediaType.APPLICATION_XML_VALUE)
    public String mybankNotifyManage(String xmlContext) throws Exception {
        System.out.println("打款请求报文"+xmlContext);
        //校验请求数据验签 及 校验appId; 校验不过会抛出异常
        commomRequstHandle.checkNotifyRequest(xmlContext);
        //处理通知
        return commomRequstHandle.notifyRequstHandle(xmlContext);
    }

    
    @ResponseBody
    @PostMapping(value = "/grantNoify", produces = MediaType.APPLICATION_XML_VALUE)
    public String grantNoify(String xmlContext) throws Exception {
        System.out.println("返回报文"+xmlContext);
        //校验请求数据验签 及 校验appId; 校验不过会抛出异常
        commomRequstHandle.checkNotifyRequest(xmlContext);
        //处理通知
        return commomRequstHandle.notifyRequstHandle(xmlContext);
    }
}
